#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "DirectedRelationship.h"
#include "PackageableElement.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class NamedElement;

/// <summary>
/// Dependency
/// A Dependency is a Relationship that signifies that a single model Element or a
/// set of model Elements requires other model Elements for their specification or
/// implementation. This means that the complete semantics of the client Element(s)
/// are either semantically or structurally dependent on the definition of the
/// supplier Element(s).
/// </summary>
class UMLMODEL_EXPORT Dependency : public DirectedRelationship, public PackageableElement {

public: // Constructors and destructors
    explicit Dependency(const QString& umlType="uml::Dependency");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// clients getter
    /// The Element(s) dependent on the supplier Element(s). In some cases (such as a
    /// trace Abstraction) the assignment of direction (that is, the designation of the
    /// client Element) is at the discretion of the modeler and is a stipulation.
    /// </summary>
    vector<shared_ptr<NamedElement>>& clients();

    /// <summary>
    /// suppliers getter
    /// The Element(s) on which the client Element(s) depend in some respect. The
    /// modeler may stipulate a sense of Dependency direction suitable for their domain.
    /// </summary>
    vector<shared_ptr<NamedElement>>& suppliers();

private: // Fields
    /// <summary>
    /// clients
    /// The Element(s) dependent on the supplier Element(s). In some cases (such as a
    /// trace Abstraction) the assignment of direction (that is, the designation of the
    /// client Element) is at the discretion of the modeler and is a stipulation.
    /// </summary>
    vector<shared_ptr<NamedElement>> clients_;

    /// <summary>
    /// suppliers
    /// The Element(s) on which the client Element(s) depend in some respect. The
    /// modeler may stipulate a sense of Dependency direction suitable for their domain.
    /// </summary>
    vector<shared_ptr<NamedElement>> suppliers_;

};

} // namespace uml
